package com.gzucm.Scholarship.common.base;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;

import java.util.List;
import java.util.Map;

public interface BaseService<T extends BaseEntity> {

    T save(T entity);

    List<T> save(Iterable<T> iterable);

    void delete(T entity);

    void delete(String id);

    void delete(Iterable<T> iterable);

    void delete(String... ids);

    void logicalDelete(T entity);

    void logicalDelete(String id);

    void logicalDelete(Iterable<T> iterable);

    void logicalDelete(String... ids);

    T findById(String id);

    List<T> findByIds(Iterable<String> iterable);

    List<T> findAll();

    List<T> findAll(Map<String, Object> params);

    Page<T> listByPage(Pageable pageable);

    Page<T> listByPage(Specification<T> spec, Pageable pageable);

    Page<T> listByPage(Map<String, Object> params, Pageable pageable);

    Long count();

    Long count(Specification<T> spec);

    Boolean existsById(String id);

}
